const util = {
    getFestival: current => {
        let festival = {icon:'default'};
        data.forEach(v => {
            let st = new Date(v.st).getTime(),
                et = new Date(st + 1000 * 60 * 60 * 24 * v.days - 1000).getTime();
            if(current > st && current < et) festival = v
        })

        return festival;
    }
}

const data = [
    {
        "title": "万圣节",
        "st": "2018/10/31 00:00:00",
        "et": "2018/11/05 23:59:59",
        "days": 6,
        "isHover":false,
        "icon": "ws"
    },
    {
        "title": "冬至",
        "st": "2018/12/20 00:00:00",
        "et": "2018/12/23 23:59:59",
        "days": 4,
        "isHover":false,
        "icon": "dz"
    },
    {
        "title": "圣诞",
        "st": "2018/12/24 00:00:00",
        "et": "2018/12/25 23:59:59",
        "days": 2,
        "isHover":false,
        "icon": "sd1"
    },
    {
        "title": "圣诞后",
        "st": "2018/12/26 00:00:00",
        "et": "2018/12/28 23:59:59",
        "days": 3,
        "isHover":false,
        "icon": "sd2"
    },
    {
        "title": "元旦",
        "st": "2018/12/29 00:00:00",
        "et": "2019/01/01 23:59:59",
        "days": 4,
        "isHover":false,
        "icon": "yd1"
    },
    {
        "title": "元旦后",
        "st": "2019/01/02 00:00:00",
        "et": "2019/01/07 23:59:59",
        "days": 6,
        "isHover":false,
        "icon": "yd2"
    },
    {
        "title": "新年",
        "st": "2019/01/30 00:00:00",
        "et": "2019/02/13 23:59:59",
        "days": 15,
        "isHover":false,
        "icon": "xn"
    },
    {
        "title": "214情人节",
        "st": "2019/02/14 00:00:00",
        "et": "2019/02/15 23:59:59",
        "days": 2,
        "isHover":true,
        "icon": "214"
    },
    {
        "title": "元宵节",
        "st": "2019/02/18 00:00:00",
        "et": "2019/02/20 23:59:59",
        "days": 3,
        "isHover":false,
        "icon": "yxj"
    },
    {
        "title": "38妇女节",
        "st": "2019/03/07 00:00:00",
        "et": "2019/03/08 23:59:59",
        "days": 2,
        "isHover":false,
        "icon": "38"
    }
]

export default util;
